<template>
  <div data-v-50910d46="" class="phone">
    <div data-v-50910d46="" class="bingPhone">
      <div data-v-50910d46="" class="font-px34 color-333">修改手机号</div>
      <div data-v-50910d46="">
        <input
          data-v-50910d46=""
          type="number"
          placeholder="请输入新的手机号"
          maxlength="11"
          class="nameinput"
          v-model="phone"
        />
      </div>
    </div>
    <div data-v-50910d46="" class="btn" @click="keepinfo">保存</div>
  </div>
</template>

<script>
import { userUpdate } from "@/api/zl-goods";
import { mapState } from "vuex";
export default {
  data() {
    return {
      phone: "",
    };
  },
  computed: {
    ...mapState({
      userInfo: (state) => state.zlstore.userinfo,
    }),
  },
  methods: {
    keepinfo() {
      userUpdate(this.userInfo._id, { phone: this.phone }).then((res) => {
        if (res.data.code == 666) {
          this.$store.commit("zlstore/initusreinfoMut", {...this.userInfo,phone:this.phone});
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
</style>